package com.twu.biblioteca.impl;

import com.twu.biblioteca.entity.Movie;

import java.util.List;
import java.util.Scanner;

public class ViewMovie {

    public boolean showTheListOfMovie(List<Movie> allMovie) {
        boolean flag = false;
        try {
            System.out.println("Movie\tYear\tDirector\tRating");
            for (int index = 0; index < allMovie.size(); index++)
            {
                Movie movie = new Movie();
                movie = allMovie.get(index);
                if (movie.getRating() != 0)
                    System.out.println(movie.getMovieName()+"\t"+movie.getYear()+"\t"+movie.getDirector()+"\t"+movie.getRating());
                else
                    System.out.println(movie.getMovieName()+"\t"+movie.getYear()+"\t"+movie.getDirector()+"\tN/A");
            }
            System.out.println("\n>> Enter 'return' to home menu, or 'exit' to quit:");
            flag = true;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return flag;
    }

    public String getNextOperation() {
        Scanner sc = new Scanner(System.in);
        String nextOperation = sc.nextLine();
        return nextOperation;
    }
}
